<?php
// +----------------------------------------------------------------------
// | Author: Bigotry <3162875@qq.com>
// +----------------------------------------------------------------------

namespace app\admin\controller;

use think\Controller;
use app\common\logic\Docxs as LogicDocxs;
use app\common\logic\Doccon as LogicDoccon;


class Ybcommand extends Controller
{
    
   public function copyfile($fileid){
   	
   	 $fileinfo = model('file')->where(['id'=>$fileid])   ->find();
   	
   	  copy(getfileurl_jd($fileid,0), PATH_UPLOAD.'doc'.DS.$fileinfo['savename']);
   	  
   	  
   	
   }
   
   //计划任务
   public function twentyfour(){
   
   	$docxsLogic = get_sington_object('docxsLogic', LogicDocxs::class);

   	$docxslist = $docxsLogic->getDocxsList(['m.status'=>1], true, 'm.id desc');
   
  
   	
   foreach ($docxslist as $k => $v){
   
   if(lefttime($v['create_time'])>0){
   	if($v['days']-lefttime($v['create_time'])>0){
   		 
   		 
   		 
   		$docxsLogic->setDocxsValue(['id'=>$v['id']],'days',$v['days']-lefttime($v['create_time']));
   		 
   	}else{
   		 
   		$data['id']=$v['id'];
   		$data['days']=0;
   		$data['status']=2;
   		$docxsLogic->setDocxsInfo($data);
   		//悬赏结束如果还没有一篇文档，则退还积分，还未写
   		if($v['reply']==0){
   			
   			point_change($v['uid'],'point',$v['score'],1,'docxsfb',$v['id'],0);
   			
   		}
   		 
   		 
   	}
   }
   	

   	
   	}

   	

   	
   
   }

}
